<#assign module="sys"/>

<@override name="header">
</@override>
<@override name="body">

	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-default">
				<div class="panel-heading">
					修改黑名单
			    </div>
			    <div class="panel-body">
    				<form id="submit_form" action="${ctx}/blacklist/update" class="form-horizontal" method="post">
		               	<input type="hidden" name="id" value="${blackList.id}">
		                <div class="form-group">
		                    <label class="col-sm-3 control-label"><em>*</em>电话号码：</label>
		                    <div class="col-sm-3">
		                    	<input class="form-control" id="phone" name="phone" type="text" required readonly value="${blackList.phone?if_exists}"/>
		                    </div>
		                </div>
		                
		                <div class="form-group">
		                    <label class="col-sm-3 control-label">备注：</label>
		                    <div class="col-sm-3">
		                    	<textarea class="form-control" cols="20" id="memo" name="memo" rows="2">${blackList.memo?if_exists}</textarea>
		                    </div>
		                </div>
		                
		                <div class="form-group" style="margin-left:10px;">
			                <label class="col-sm-3 control-label"></label>
			                <input id="submit_button" type="submit" class="btn btn-primary" value="修改">
			                <input type="button" class="btn btn-default" onclick="window.location.href = '${ctx}/blacklist/list';" value="返回">
			            </div>
			            
					</form>
        		</div>
			</div>
		</div>
	</div>

</@override>
<@override name="footer">
<script type="text/javascript">
	$(document).ready(function(){
		
		$("#submit_form").submit(function(){
		
			var phone=$("#phone").val();
			var isphone=/^\+?\d{3,13}(\-?(\d{6,8}?))?(\-?(\d{4,8}?))*$/; 
			if (!isphone.test(phone)){
				$.scojs_message("电话号码格式不正确", $.scojs_message.TYPE_ERROR);
				return false;
			}
			
			$("#submit_button").attr("disabled",true);
			$.post($("#submit_form").attr("action"),$("#submit_form").serialize(),function(result){
				if(result.success){
					$.scojs_message('修改成功', $.scojs_message.TYPE_OK);
                	window.location="${ctx}/blacklist/list";
				}
				else{
					$.scojs_message(result.message, $.scojs_message.TYPE_ERROR);
					$("#submit_button").attr("disabled",false);
				}
			});
		
			return false;
		});

	});
	
</script>
</@override>
<@extends name="../layout.ftl"/>